package com.kakame.codenews.front.dict.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.kakame.codenews.base.web.annotation.CacheOperate;
import com.kakame.codenews.base.web.enumeration.CacheOperateType;
import com.kakame.codenews.base.web.fast.mapping.common.Dict;
import com.kakame.codenews.front.dict.dao.FrontDictDao;
import com.kakame.codenews.front.dict.service.FrontDictService;

@Service
public class FrontDictServiceImpl implements FrontDictService {

	@Resource
	private FrontDictDao dictDao;
	
	@Override
	public List<Dict> list(Dict dict) {
		return dictDao.list(dict);
	}

    @Override
    @CacheOperate(operateType = CacheOperateType.GET, returnType = Dict.class)
    public Dict getByGrandPaCodeAndValue(String grandPaCode, String value) {
        return dictDao.list(Dict.create().dictGrandpaCode(grandPaCode).dictValue(value).build()).get(0);
    }
}
